//
//  NSString+Extension.m
//  赛拓
//
//  Created by 王磊 on 7/31/16.
//  Copyright © 2016 立金所. All rights reserved.
//

#import "NSString+Extension.h"

@implementation NSString (Extension)

+ (CGSize )suitToSize:(NSString *)text withSize:(CGSize)size andFont:(UIFont *)font andLineSpacing:(CGFloat )lineSpacing {
    
    NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc]init];
    
    style.lineSpacing = lineSpacing == 0 ? 3 : lineSpacing;
    
    return [text boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : font ,NSParagraphStyleAttributeName : style} context:nil].size;
    
}

+ (BOOL)validPhoneNumber:(NSString *)phoneNumber {
    if (phoneNumber.length > 0) {
        unichar num = [phoneNumber characterAtIndex:0];
        return num == '1' ? true : false;
        
    }else {
        return false;
    }
}


@end
